#include <my_head.h>

int main(int argc, const char *argv[]){
    int fd = 0;
    if(-1 == (fd = open("my_fifo", O_RDONLY)))
        ERR_LOG("open error");
    // 有名管道必须同时打开读写两端才可以操作
    // 否则 本侧的open就阻塞了
    printf("管道文件打开成功\n");
    char buff[128];
    sleep(100);
    while(1){   
        read(fd, buff, sizeof(buff));
        if(!strcmp(buff, "quit")){
            break;
        }
        printf("读到内容 : [%s]\n", buff);
    }
    close(fd);
    return 0;
}